<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>设置训练期间使用的回调函数。</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.fann-set-callback" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">fann_set_callback</h1>
  <p class="verinfo">(PECL fann &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">fann_set_callback</span> &mdash; <span class="dc-title">设置训练期间使用的回调函数。</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.fann-set-callback-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>fann_set_callback</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$ann</code></span>
   , <span class="methodparam"><span class="type"><span class="type collable">collable</span></span> <code class="parameter">$callback</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   设置训练期间使用的回调函数。 这意味着它被<span class="function"><a href="fann_train_on_data.html" class="function">fann_train_on_data()</a></span> 或 <span class="function"><a href="fann_train_on_file.html" class="function">fann_train_on_file()</a></span>调用。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.fann-set-callback-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">ann</code></dt>

    <dd>

     <p class="para">Neural network <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span>.</p>
    </dd>

   
   
    <dt>
<code class="parameter">callback</code></dt>

    <dd>

     <p class="para">
     提供的回调函数接受以下参数：
      <ul class="simplelist">
       <li class="member"><em>ann</em> - 神经网络 <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span></li>
       <li class="member"><em>train</em> - 训练数据 <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span>
        或者 当被 <span class="function"><a href="fann_train_on_file.html" class="function">fann_train_on_file()</a></span> 为 <strong><code>NULL</code></strong></li>
       <li class="member"><em>max_epochs</em> - 训练将进行的最大周期数。</li>
       <li class="member"><em>epochs_between_reports</em> - 在调用该函数之前训练进行的最大周期数。</li>
       <li class="member"><em>desired_error</em> - 期望的 <span class="function"><a href="fann_get_mse.html" class="function">fann_get_MSE()</a></span> 或者
        <span class="function"><a href="fann_get_bit_fail.html" class="function">fann_get_bit_fail()</a></span>, 取决于<span class="function"><a href="fann_set_train_stop_function.html" class="function">fann_set_train_stop_function()</a></span>函数选择的停止函数。</li>
       <li class="member"><em>epochs</em> - The current epoch</li>
      </ul>
     </p>
     <p class="para">
      回调将会返回 <strong><code>TRUE</code></strong>. 如果返回 <strong><code>FALSE</code></strong>, 表明训练将会终止。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.fann-set-callback-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">Returns <strong><code>TRUE</code></strong> on success, or <strong><code>FALSE</code></strong> otherwise.</p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.fann-set-callback-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="fann_train_on_data.html" class="function" rel="rdfs-seeAlso">fann_train_on_data()</a> - 在整个数据集上训练一段时间。</span></li>
    <li class="member"><span class="function"><a href="fann_train_on_file.html" class="function" rel="rdfs-seeAlso">fann_train_on_file()</a> - 在从某个文件读取的整个数据集上训练一段时间。</span></li>
   </ul>
  </p>
 </div>



</div></div></div></body></html>